package com.example.Aop;

import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Description TODO
 * @Date 2024/5/16 0:07
 * @Created by houjunfeng
 */
public class AopTest {
    @Test
    public void test(){
        //自己new的类不能被代理，必须得是bean被Spring管理的才行
//        Target target = new Target();
//        Integer result = target.div(1,1);
//        System.out.println(result);

        AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(AOPConfiguration.class);
        Target target = annotationConfigApplicationContext.getBean(Target.class);
        Integer result = target.div("256",5);
        System.out.println(result);
    }
}
